@extends('layout.index')
@section('title','后台分类添加')

@section('content')
<div class="row">
    <div class="col-lg-8">
        <h1 class="page-header">分类添加</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>

<div class="row">
	
    <div class="col-lg-8 ">
    	<div class="panel panel-default">						<div class="panel-heading">	
    			<!-- 显示内存中的错误信息 -->
    			<!-- @if(session('error'))
    			<div class="alert alert-danger alert-dismissable">
                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                    {{session('error')}}
                </div>
                @endif -->

                @if (count($errors) > 0)
				    <div class="alert alert-danger">
				        <ul>
				            @foreach ($errors->all() as $error)
				                <li>{{ $error }}</li>
				            @endforeach
				        </ul>
				    </div>
				@endif
    		</div>		

    		<div class="row">
    		<div class="col-lg-2"></div>
    			  <div class="col-lg-8 ">
    			<br>
			<form role="form" action="{{url('/admin/cate/insert')}}" method="post" enctype="multipart/form-data">
				<div class="form-group">
                    <label>分类列表</label>
                    <select name="pid" class="form-control">
                        <option value="0">顶级分类</option>
                    @foreach($cates as $k=>$v)
                        <option value="{{$v->id}}">{{$v->name}}</option>
                    @endforeach
                    </select>
                </div>
			    <div class="form-group">
			        <label>分类名</label>
			        <input type="text" name="name" value="{{old('username')}}" class="form-control">
			    </div>					    
			    <!-- token隐藏域 -->
			    {{csrf_field()}}
			    <button class="btn btn-primary " type="submit">添加</button>
			    <button class="btn btn-warning " type="reset">重置</button>
			</form>
			</div>
			</div>
			<br>
	</div>
   </div>
</div>
@endsection